package com.atguigu.day02;

import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;


public class Flink02_Source_Collcetion {
    public static void main(String[] args) throws Exception {
        //1.获取流的执行环境
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

        env.setParallelism(1);
        //TODO 从集合中读取数据
//        List<String> stringList = Arrays.asList("1", "2", "3", "4");
//        DataStreamSource<String> streamSource = env.fromCollection(stringList);


        //TODO 从元素中读取数据
        DataStreamSource<String> streamSource = env.fromElements("1", "2", "3", "4").setParallelism(2);

        streamSource.print();

        env.execute();
    }
}
